package com.api.user.task;

import com.api.user.service.AchievementService;
import com.api.user.service.UserInfoService;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import javax.annotation.Resource;

@Configuration
@EnableScheduling
public class SaticScheduleTask {
    @Resource
    AchievementService achievementService;
    @Resource
    UserInfoService userInfoService;

    /**
     * 定时清理未完成的徽章
     */
    @Scheduled(fixedRate=600000)
    private void configureTasks() {
        achievementService.cleaning();
    }


    /**
     * 会员过期变回 basic 每天23点执行
     */
    @Scheduled(cron = "0 0 23 * * ?")
    private void vipExpire() {
        userInfoService.vipExpire();
    }

}
